<Title Level="4">@_options.Count() Items</Title>

<Select Mode="multiple"
        Placeholder="Please select"
		DataSource="@_options"
		@bind-Values="@_selectedValues"
		LabelName="@nameof(LabeledValue.Label)"
        ValueName="@nameof(LabeledValue.Value)"
		DisabledName="@nameof(LabeledValue.Disabled)"
		TItemValue="string"
		TItem="LabeledValue"
		OnSelectedItemsChanged="OnSelectedItemsChangedHandler"
		EnableSearch
        EnableVirtualization>
</Select>

<Select Mode="default"
        Placeholder="Please select"
        DataSource="@_options"
        @bind-Value="@_selectedValue"
        LabelName="@nameof(LabeledValue.Label)"
        ValueName="@nameof(LabeledValue.Value)"
        DisabledName="@nameof(LabeledValue.Disabled)"
        TItemValue="string"
        TItem="LabeledValue"
        OnSelectedItemChanged="OnSelectedItemChangedHandler"
        EnableSearch
        EnableVirtualization
        Style="width: 100%; margin-top: 8px;">
</Select>

@code
{
	class LabeledValue
	{
		public LabeledValue () {} 
		public LabeledValue (string value, string label, bool disabled) 
		{
			Value = value;
			Label = label;
			Disabled = disabled;
		}
		
		public string Value { get; set; }
		public string Label { get; set; }
		public bool Disabled { get; set; }
	}
	
    List<LabeledValue> _options;
	IEnumerable<string> _selectedValues = new List<string> { "0a10", "0c12" };
    string _selectedValue = "000";
    protected override void OnInitialized()
    {
        const int min = 0;
        const int max = 2000;
        _options = new List<LabeledValue>();

        for (var i = min; max > i; i++)
        {
            var disabled = i == 10;
            var value = Convert.ToString(i, 16).PadLeft(2, '0') + i.ToString();
            _options.Add(new LabeledValue(value, value, disabled));
        }
    }

    private void OnSelectedItemsChangedHandler(IEnumerable<LabeledValue> values)
    {
        Console.WriteLine($"selected: ${string.Join(",", values.Select(x => x.Label))}");
    }
    private void OnSelectedItemChangedHandler(LabeledValue value)
    {
        Console.WriteLine($"selected: ${value.Label}");
    }
}
